package com.gs.SynPatrolRep.model;

import com.gs.SynPatrolRep.callback.Callback;
import com.gs.SynPatrolRep.model.listener.OnResultListener;
import com.gs.SynPatrolRep.util.OKHttpUtil;

import java.lang.reflect.Type;

public class SettingsModel {

    public void changeAreaId(String json, final OnResultListener onResultListener, Type typeofT){
        OKHttpUtil.getInstance().postAsync(OKHttpUtil.NET_URL + "/api/users/switchArea", json,
                new Callback() {
                    @Override
                    public void onSuccess(Object obj) {
                        onResultListener.onSuccess(obj);
                    }

                    @Override
                    public void onFailed(Exception e) {
                        onResultListener.onFails(e);
                    }
                },typeofT);
    }

    public void changeLanguage(String json, final OnResultListener onResultListener, Type typeofT){
        OKHttpUtil.getInstance().postAsync(OKHttpUtil.NET_URL + "/api/users/switchLang", json,
                new Callback() {
                    @Override
                    public void onSuccess(Object obj) {
                        onResultListener.onSuccess(obj);
                    }

                    @Override
                    public void onFailed(Exception e) {
                        onResultListener.onFails(e);
                    }
                },typeofT);
    }
}
